package com.ticketbooking.controller;

import com.alibaba.fastjson.JSONArray;
import com.ticketbooking.constant.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by linzhi on 2017/8/23.
 */
@Controller
@RequestMapping("/moreConditions")
public class MoreConditionsController {
    @RequestMapping("/index")
    public String index() {
        return "moreConditions/index";
    }

    @RequestMapping("/getData")
    public String getData(String condition, Model model) {
//        JSONObject condJson = JSONObject.parseObject(condition);//可以也兼容这种
        JSONArray objects = JSONArray.parseArray(condition);//由于sql的where条件可能放在多个地方，所以传入多个条件项（条件数组）
        model.addAttribute(objects);

        return Constant.JSON_VIEW_OTHER;
    }
}
